<html>
<head>
<title>close</title>
<body bgcolor=#ffffff>
<h2 align=center>close</h2>
<h4 align=center>OS/161 Reference Manual</h4>

<h3>Name</h3>
close - close file

<h3>Library</h3>
Standard C Library (libc, -lc)

<h3>Synopsis</h3>
#include &lt;unistd.h&gt;<br>
<br>
int<br>
close(int <em>fd</em>);

<h3>Description</h3>

The file handle <em>fd</em> is closed. The same file handle may then
be returned again from <A HREF=open.html>open</A>,
<A HREF=dup2.html>dup2</A>, <A HREF=pipe.html>pipe</A>, or similar
calls.
<p>

Other file handles are not affected in any way, even if they are
attached to the same file.
<p>

<h3>Return Values</h3>
On success, close returns 0. On error, -1 is returned, and
<A HREF=errno.html>errno</A> is set according to the error
encountered.

<h3>Errors</h3>

The following error codes should be returned under the conditions
given. Other error codes may be returned for other errors not
mentioned here.

<blockquote><table width=90%>
<tr><td width=10%>&nbsp;</td><td>&nbsp;</td></tr>
<tr><td>EBADF</td>	<td><em>fd</em> is not a valid file handle.</td></tr>
<tr><td>EIO</td>	<td>A hard I/O error occurred.</td></tr>
</table></blockquote>

</body>
</html>
